<template>
    <div id="allLog">
        <div class="cont">
            <div class="inpexplain">
			    <span>物流公司</span><input  placeholder="请输入物流公司" v-model="delivery_name"></input>
		    </div>
            <div class="inpexplain">
			    <span>订单编号</span><input  placeholder="请输入订单编号" v-model="delivery_sn"></input>
		    </div>
        </div>
        <v-alert :context="context" v-if="showAlert"></v-alert>
        <button @click="submit">提交</button>
    </div>
</template>

<script>
    import config from "../config/config.js";
    import Alert from "../alert.vue";
    export default{
        data(){
            return{
                context:'',
                showAlert:false,
                delivery_name:'',
                delivery_sn:''
            }
        },
        components:{
            "v-alert":Alert
        },
        methods:{
            submit(){
                var _self=this;
               if(this.delivery_name==''||this.delivery_sn==''){
                   this.showAlert=true;
                   this.context='请完善物流信息';
                   setTimeout(()=>{_self.showAlert=false},2000)
               }else{
                   var value=JSON.stringify({"orderid":this.$route.params.orderid,"delivery_name":this.delivery_name,"delivery_sn":this.delivery_sn,"token":localStorage.getItem('token')}),
                       key=demo(value);
                   axios.post('/Home/refund/UpdataLogicInfo',{
                       value:value,
                       key:key
                   },config)
                       .then(function(response) {
                           if(response.data.code==200){
                               this.$router.push('/allorder/flow/'+this.$route.params.orderid)
                           }
                       }.bind(this))
                       .catch(function (error) {
                           console.log(error);
                       });
               }
            },
        }
    }
</script>

<style>
    
</style>